package user;

import book.BookList;
import operation.*;

import java.util.Scanner;

public class AdminUser extends User{
    public AdminUser(String name) {
        super(name);
        ioPerations = new IOPeration[]{
                new ExitOperation(),
                new AddOperation(),
                new DelOperation(),
                new ShowOperation(),
                new FindOperation()
        };
    }
    public int menu(){
        Scanner scanner = new Scanner(System.in);
        System.out.println("#######管理员#########");
        System.out.println("     1.增加图书");
        System.out.println("     2.删除图书");
        System.out.println("     3.显示图书");
        System.out.println("     4.查找图书");
        System.out.println("     0.退出系统");
        System.out.println("######################");
        System.out.println("请输入您要进行的操作：--》");
        int choice = scanner.nextInt();
        return choice;
    }
    public void doOperation(int pos,BookList bookList){
        IOPeration ioPeration = ioPerations[pos];
        ioPeration.work(bookList);
    }
}
